/**
 * 
 */
package com.ubo.graphviz.model.graph.statement.node;

import java.util.Collection;

import com.ubo.graphviz.model.graph.statement.Attribute;
import com.ubo.graphviz.model.graph.statement.AttributeList;
import com.ubo.graphviz.model.graph.statement.IStatement;
import com.ubo.graphviz.model.graph.statement.Port;
import com.ubo.transform.dot.IDotVisitor;
import com.ubo.visu.model.EEntityType;

/**
 * @author saludegu
 * 
 */
public class NodeStmt implements IStatement {

	/**
	 * Identifiant du noeud.
	 */
	protected final int mIdNode;

	/**
	 * Nom du noeud.
	 */
	protected String mName;

	/**
	 * Port du node.
	 */
	protected Port mPort;

	/**
	 * Liste des attributs du noeud.
	 */
	protected AttributeList mAttributes;

	/**
	 * Style du noeud.
	 */
	protected String mStyle;

	/**
	 * Font du noeud.
	 */
	protected String mFont;

	/**
	 * Taille de la font.
	 */
	protected String mFontSize;

	/**
	 * Label du noeud.
	 */
	protected StringBuffer mLabel;

	/**
	 * Style du shape.
	 */
	protected String mShapeStyle;

	/**
	 * FillColo du shape.
	 */
	protected String mFillColor;

	protected EEntityType mEntityType;

	/**
	 * 
	 * Constructor
	 * 
	 * @param nodeName
	 */
	public NodeStmt(String nodeName, int idNode, EEntityType entityType) {
		mName = nodeName;
		mIdNode = idNode;
		mEntityType = entityType;
	}

	/**
	 * @return the mName
	 */
	public String getName() {
		return mName;
	}

	/**
	 * @param mName
	 *            the mName to set
	 */
	public void setName(String mName) {
		this.mName = mName;
	}

	/**
	 * @return the mPort
	 */
	public Port getPort() {
		return mPort;
	}

	/**
	 * @param mPort
	 *            the mPort to set
	 */
	public void setPort(Port mPort) {
		this.mPort = mPort;
	}

	/**
	 * @return the mAttributes
	 */
	public AttributeList getAttributes() {
		return mAttributes;
	}

	/**
	 * Ajout d'un attribut à la liste.
	 * 
	 * @param attr
	 */
	public void addAttribute(Attribute attr) {
		if (mAttributes == null)
			mAttributes = new AttributeList();
		mAttributes.addAttribute(attr);
	}

	/**
	 * Ajout d'une collection d'attributs.
	 * 
	 * @param attributes
	 */
	public void addAllAttribute(Collection<Attribute> attributes) {
		if (mAttributes == null)
			mAttributes = new AttributeList();
		mAttributes.addAllAttribute(attributes);
	}

	/**
	 * @return the mStyle
	 */
	public String getStyle() {
		return mStyle;
	}

	/**
	 * @param mStyle
	 *            the mStyle to set
	 */
	public void setStyle(String mStyle) {
		this.mStyle = mStyle;
	}

	/**
	 * @return the mFont
	 */
	public String getFont() {
		return mFont;
	}

	/**
	 * @param mFont
	 *            the mFont to set
	 */
	public void setFont(String mFont) {
		this.mFont = mFont;
	}

	/**
	 * @return the mFontSize
	 */
	public String getFontSize() {
		return mFontSize;
	}

	/**
	 * @param mFontSize
	 *            the mFontSize to set
	 */
	public void setFontSize(String mFontSize) {
		this.mFontSize = mFontSize;
	}

	/**
	 * @return the mLabel
	 */
	public StringBuffer getLabel() {
		return mLabel;
	}

	/**
	 * @param mLabel
	 *            the mLabel to set
	 */
	public void setLabel(StringBuffer mLabel) {
		this.mLabel = mLabel;
	}

	/**
	 * @return the mShapeStyle
	 */
	public String getShapeStyle() {
		return mShapeStyle;
	}

	/**
	 * @param mShapeStyle
	 *            the mShapeStyle to set
	 */
	public void setShapeStyle(String mShapeStyle) {
		this.mShapeStyle = mShapeStyle;
	}

	/**
	 * @return the mFillColor
	 */
	public String getFillColor() {
		return mFillColor;
	}

	/**
	 * @param mFillColor
	 *            the mFillColor to set
	 */
	public void setFillColor(String mFillColor) {
		this.mFillColor = mFillColor;
	}

	/**
	 * @see com.ubo.graphviz.model.graph.statement.IStatement#generate(com.ubo.transform.dot.IDotVisitor)
	 */
	@Override
	public void generate(IDotVisitor<?> visitor) {
		visitor.generate(this);
	}

	/**
	 * @return the mIdNode
	 */
	public int getIdNode() {
		return mIdNode;
	}

	/**
	 * @return
	 */
	public EEntityType getType() {
		return mEntityType;
	}

}
